<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Client</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.STYLE2 {font-weight: bold}
.STYLE2 {font-size: 18px}
-->
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
.STYLE1 {font-size: 18px}
-->
</style>
</head>

<body>
<table width="877" height="53" border="0" cellspacing="0" align="center">
  <tr>
    <td width="8">&nbsp;</td>
    <td width="848"><div align="center">
      </p>
      <img src="../../../image/logo.jpg" alt="logo" width="929" height="155" /></div></td>
    <td width="15">&nbsp;</td>
  </tr>
</table>
<table width="512" border="0" cellspacing="0" align="center">
  <tr>
    <th width="86" height="29" class="STYLE1" scope="row">about us </th>
    <th width="90" class="STYLE1" scope="row">products show </th>
    <th width="80" class="STYLE1" scope="row">company news </th>
    <td width="104" class="STYLE1"><strong>contact us </strong></td>
    <td width="142"><div align="center" class="STYLE1">
      <p><a href="../../../manufacturer/view/ManufacturerViewLogin.php">User Login</a></p>
    </div></td>
  </tr>
</table>

<table width="975" border="0" cellspacing="0">
  <tr>
    <td width="164" rowspan="9"><table border="1"><td height="37" colspan="2" scope="row"><h2>Link List </h2></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3><strong>Stock</strong></h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="../../../Stock/view/StockViewList.php">Stock List</a><br />
            <a href="../../../Stock/view/StockViewAdd.php">Add Stock</a></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3><strong>Raw Material<br />
    </strong></h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="../../../rawMaterial/view/rawMaterialViewList.php">Raw Material list</a><a href="../../../rawMaterial/view/rawMaterialViewAdd.php"><br />
    Add Raw Material</a> <br /></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3><strong>Sale</strong>-Client</h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="clientViewList.php">Client List</a><br />
            <a href="clientViewAdd.php">Add Client</a></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3>Sale-Merchandise
        </h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="../../merchandise/saleOut/view/merchandiseViewSaleOut.php">Merchandise-Sale out</a><br /><a href="../../merchandise/saleOut/view/merchandiseViewSaleOut.php">Merchandise-Return</a> <br />
      <a href="../../merchandise/saleOut/view/merchandiseViewList.php">Merchandise-List</a></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3>Sale-Order</h3></td>
    </tr>
  <tr>
    <td scope="row"><a href="../../order/view/orderViewList.php">Order-List</a><br />
      <a href="../../order/view/orderViewAdd.php">Order-Add</a>
  </table></td>
    <td width="807" rowspan="8"><!-- InstanceBeginEditable name="EditRegion3" -->
      <?php 
    include ("../../../Connections/SCMS.php"); 
	include ("../../../Model/errorReportClass.php");
	$alret = new errorReportClass();
	 session_start();
	 $manufacturer = $_SESSION['manufacturer'];
	if($manufacturer == NULL){
	$reportTo ="../../../manufacturer/view/ManufacturerViewLogin.php";
       $alret->errorReport(4, $reportTo);
       exit; 
	}
 
//get information from rawmaterial table	 
   $selectedId = $_POST[searchselect];
	$inputValue = $_POST[search];
	
	$retrievalId = $_POST[retrieval];
	$smallValue = $_POST[smallValue];
	$bigValue = $_POST[bigValue];
	
	if($selectedId != NULL){
   	if($selectedId == 4){
 			$query = "select * from client;";
		}
		else if($selectedId == 0){
 			$query = "select * from client where cname ='$inputValue';";
		}
		else if($selectedId == 1){
 			$query = "select * from client where cid ='$inputValue';";
		}
		else if($selectedId == 2){
 			$query = "select * from client where cphone ='$inputValue';";
		}
		else if($selectedId == 3){
 			$query = "select * from client where rank ='$inputValue';";
		}
	}
	else if($retrievalId != NULL){
   	if($retrievalId == 0){
 			$query = "select * from client;";
		}
		else if($retrievalId == 1){
 			$query = "select * from client where cid between '$smallValue' and '$bigValue';";
		}	
	}
	else{
   	$query = "select * from client;";		
	}
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
?>
      <form id="searchingform" name="searchingform" method="post" action="clientViewList.php" >
        <table width="400" border="0" cellspacing="0" align="center">
          <tr>
            <td><h2><strong>Searching: </strong></h2></td>
            <td><select name="searchselect">
                <option value="0">Clinet Name</option>
                <option value="1">Clinet ID</option>
                <option value="2" >Clinet phone</option>
                <option value="3" >Clinet rank</option>
                <option value="4" selected="selected">Please Choose</option>
            </select></td>
            <td><input name="search" type="text" size="40" /></td>
            <td><input type="submit" name="Submit3" value="Searching" /></td>
          </tr>
        </table>
      </form>
      <form id="form1" name="form1" method="post" action="clientViewList.php">
        <table width="608" height="23" border="0" cellspacing="0" align="center">
          <tr>
            <td width="63" height="21"><h2><strong>Retrieval:</strong></h2></td>
            <td width="63"><select name="retrieval">
                <option value="0"selected="selected">Please Choose</option>
                <option value="1">Client ID</option>
            </select></td>
            <td>From:</td>
            <td><input name="smallValue" type="text"/></td>
            <td>To:</td>
            <td><input name="bigValue" type="text"/></td>
            <td><input type="submit" name="Submitretrieval" value="Searching" /></td>
          </tr>
        </table>
      </form>
      <table border="0" align="center">
        <tr>
          <td width="495"><strong>Client List <span class="STYLE2"></span>: </strong></td>
          <td width="47">&nbsp;</td>
          <td width="47">&nbsp;</td>
          <td width="47">&nbsp;</td>
          <td width="47">&nbsp;</td>
          <td width="70">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="6"><table width="773" height="40" border="1" cellspacing="0">
              <tr>
                <td width="92" height="22" class="STYLE2" >Client ID </td>
                <td width="101" class="STYLE2" >Client Name</td>
                <td width="72" class="STYLE2" >Client Phone</td>
                <td width="96" class="STYLE2" >Client E-mail</td>
                <td width="158" class="STYLE2" >Rank</td>
                <td width="90" class="STYLE2" >Remark</td>
                <td width="62" class="STYLE2" >Delete</td>
                <td width="68" class="STYLE2" >Change</td>
              </tr>
              <?PHP
	   $deletePath = '../ucm/UCClientDelete.php?id=';
		$changePath = '../ucm/UCClientID.php?id=';
     while($array){
      $cid = $array['cid'];
      $cname = $array['cname'];
      $cphone = $array['cphone'];
      $cemail = $array['cemail'];
      $rank = $array['rank'];
	   $cremark = $array['cremark'];
			 
      echo ("<tr><td>" .$cid ."</td><td>" .$cname ."</td><td>" .$cphone ."</td>
		<td>" .$cemail ."</td><td>" .$rank ."</td><td>" .$cremark ."</td>
		<td><a href=\"javascript:if(confirm('Delete?'))location='".$deletePath .$cid ."'\">Delete</a></td>
		<td><a href='".$changePath .$cid."'\">Change</a></td></tr>");
      $array = mysql_fetch_array($sql);
   }	
?>
          </table></td>
          - </tr>
        <tr>
          <td colspan="6"><table border="0" align="right">
              <tr>
                <td height="25">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td><form id="form4" name="form4" method="post" action="RetrivalUser.php">
                    <div align="right">
                      <input type="submit" name="Submit4" value="Cancel" />
                    </div>
                </form></td>
              </tr>
          </table></td>
        </tr>
      </table>
      <?PHP
    $alertId = $_GET[id];

if ($alertId == 1){
   $alrentvalue = 'Delete Success!';
   $alret->alrent($alrentvalue);
}
else if ($alertId == 2){
   $alrentvalue = 'Please Try again!';
   $alret->alrent($alrentvalue);
}
else if ($alertId == 3){
   $alrentvalue = 'Change Success!';
   $alret->alrent($alrentvalue);
}
else if ($alertId == 4){
   $alrentvalue = 'Add Success!';
   $alret->alrent($alrentvalue);
}
    ?>
<!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <th scope="row">&nbsp;</th>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
